package com.liao.liaowenlong.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.widget.Toast;

public class MyService2 extends Service {
    public MyService2() {
    }

    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
        throw new UnsupportedOperationException("Not yet implemented");
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        String toast = intent.getStringExtra("Toast");
        if ("Toast1".equals(toast)) {
            fun1();
        } else {
            fun2();
        }
        return super.onStartCommand(intent, flags, startId);
    }

    private void fun1() {
        Toast.makeText(this, "Toast1", Toast.LENGTH_SHORT).show();
    }

    private void fun2() {
        Toast.makeText(this, "Toast2", Toast.LENGTH_SHORT).show();
    }
}
